.class public Lcom/TwinBlade/PicturePassword/Image;
.super Landroid/app/Activity;
.source "SourceFile"

# interfaces
.implements Landroid/view/View$OnClickListener;


# instance fields
.field private a:Landroid/widget/Button;

.field private b:Landroid/widget/Button;


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 25
    invoke-direct {p0}, Landroid/app/Activity;-><init>()V

    return-void
.end method

.method private a(Z)Landroid/net/Uri;
    .locals 4
    .parameter
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "WorldWriteableFiles"
        }
    .end annotation

    .prologue
    .line 151
    new-instance v0, Ljava/io/File;

    invoke-virtual {p0}, Lcom/TwinBlade/PicturePassword/Image;->getFilesDir()Ljava/io/File;

    move-result-object v1

    const-string v2, "PhotoData.jpg"

    invoke-direct {v0, v1, v2}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    .line 152
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v1

    if-nez v1, :cond_0

    .line 154
    :try_start_0
    const-string v1, "PhotoData.jpg"

    const/4 v2, 0x2

    invoke-virtual {p0, v1, v2}, Lcom/TwinBlade/PicturePassword/Image;->openFileOutput(Ljava/lang/String;I)Ljava/io/FileOutputStream;

    move-result-object v1

    .line 155
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 160
    :cond_0
    :goto_0
    invoke-static {v0}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object v0

    return-object v0

    .line 156
    :catch_0
    move-exception v1

    .line 157
    const v1, 0x7f0900ad

    invoke-virtual {p0, v1}, Lcom/TwinBlade/PicturePassword/Image;->getString(I)Ljava/lang/String;

    move-result-object v1

    const/4 v2, 0x4

    const/4 v3, 0x1

    invoke-static {p0, v1, v2, v3}, Lcom/TwinBlade/PicturePassword/Utilities;->a(Landroid/content/Context;Ljava/lang/String;IZ)V

    goto :goto_0
.end method

.method private a()V
    .locals 2

    .prologue
    .line 90
    new-instance v0, Landroid/content/Intent;

    const-string v1, "android.intent.action.GET_CONTENT"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 91
    const-string v1, "image/*"

    invoke-virtual {v0, v1}, Landroid/content/Intent;->setType(Ljava/lang/String;)Landroid/content/Intent;

    .line 92
    const/4 v1, 0x1

    invoke-virtual {p0, v0, v1}, Lcom/TwinBlade/PicturePassword/Image;->startActivityForResult(Landroid/content/Intent;I)V

    .line 93
    return-void
.end method

.method private b()V
    .locals 3

    .prologue
    .line 96
    new-instance v0, Landroid/content/Intent;

    const-class v1, Lcom/TwinBlade/PicturePassword/Crop;

    invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 97
    const-string v1, "CropWallpaper"

    const/4 v2, 0x1

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 98
    const/4 v1, 0x2

    invoke-virtual {p0, v0, v1}, Lcom/TwinBlade/PicturePassword/Image;->startActivityForResult(Landroid/content/Intent;I)V

    .line 99
    return-void
.end method

.method private c()V
    .locals 6

    .prologue
    const/4 v5, 0x0

    .line 132
    invoke-virtual {p0}, Lcom/TwinBlade/PicturePassword/Image;->getWindowManager()Landroid/view/WindowManager;

    move-result-object v0

    invoke-interface {v0}, Landroid/view/WindowManager;->getDefaultDisplay()Landroid/view/Display;

    move-result-object v0

    .line 133
    invoke-virtual {v0}, Landroid/view/Display;->getWidth()I

    move-result v1

    .line 134
    invoke-virtual {v0}, Landroid/view/Display;->getHeight()I

    move-result v0

    .line 136
    new-instance v2, Landroid/content/Intent;

    const-string v3, "android.intent.action.PICK"

    sget-object v4, Landroid/provider/MediaStore$Images$Media;->EXTERNAL_CONTENT_URI:Landroid/net/Uri;

    invoke-direct {v2, v3, v4}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

    .line 137
    const-string v3, "image/*"

    invoke-virtual {v2, v3}, Landroid/content/Intent;->setType(Ljava/lang/String;)Landroid/content/Intent;

    .line 138
    const-string v3, "crop"

    const-string v4, "true"

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 139
    const-string v3, "scale"

    const/4 v4, 0x1

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 140
    const-string v3, "aspectX"

    invoke-virtual {v2, v3, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 141
    const-string v1, "aspectY"

    invoke-virtual {v2, v1, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 142
    const-string v0, "return-data"

    invoke-virtual {v2, v0, v5}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 143
    const-string v0, "output"

    invoke-direct {p0, v5}, Lcom/TwinBlade/PicturePassword/Image;->a(Z)Landroid/net/Uri;

    move-result-object v1

    invoke-virtual {v2, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;

    .line 144
    const-string v0, "outputFormat"

    sget-object v1, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;

    invoke-virtual {v1}, Landroid/graphics/Bitmap$CompressFormat;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v2, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 145
    const/4 v0, 0x2

    invoke-virtual {p0, v2, v0}, Lcom/TwinBlade/PicturePassword/Image;->startActivityForResult(Landroid/content/Intent;I)V

    .line 146
    return-void
.end method


# virtual methods
.method protected onActivityResult(IILandroid/content/Intent;)V
    .locals 3
    .parameter
    .parameter
    .parameter

    .prologue
    const/4 v2, 0x4

    const/4 v1, 0x1

    const/4 v0, -0x1

    .line 64
    invoke-super {p0, p1, p2, p3}, Landroid/app/Activity;->onActivityResult(IILandroid/content/Intent;)V

    .line 65
    packed-switch p1, :pswitch_data_0

    .line 87
    :goto_0
    return-void

    .line 68
    :pswitch_0
    if-ne p2, v0, :cond_0

    if-eqz p3, :cond_0

    .line 69
    new-instance v0, Landroid/content/Intent;

    const-class v1, Lcom/TwinBlade/PicturePassword/Crop;

    invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 70
    invoke-virtual {p3}, Landroid/content/Intent;->getData()Landroid/net/Uri;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/content/Intent;->setData(Landroid/net/Uri;)Landroid/content/Intent;

    .line 71
    const/4 v1, 0x2

    invoke-virtual {p0, v0, v1}, Lcom/TwinBlade/PicturePassword/Image;->startActivityForResult(Landroid/content/Intent;I)V

    goto :goto_0

    .line 73
    :cond_0
    const v0, 0x7f0900af

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/Image;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0, v2, v1}, Lcom/TwinBlade/PicturePassword/Utilities;->a(Landroid/content/Context;Ljava/lang/String;IZ)V

    goto :goto_0

    .line 78
    :pswitch_1
    if-eq p2, v0, :cond_1

    .line 79
    const v0, 0x7f0900b0

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/Image;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0, v2, v1}, Lcom/TwinBlade/PicturePassword/Utilities;->a(Landroid/content/Context;Ljava/lang/String;IZ)V

    .line 80
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/Image;->setResult(I)V

    goto :goto_0

    .line 82
    :cond_1
    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/Image;->setResult(I)V

    .line 83
    invoke-virtual {p0}, Lcom/TwinBlade/PicturePassword/Image;->finish()V

    goto :goto_0

    .line 65
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public onClick(Landroid/view/View;)V
    .locals 1
    .parameter

    .prologue
    .line 102
    invoke-virtual {p1}, Landroid/view/View;->getId()I

    move-result v0

    packed-switch v0, :pswitch_data_0

    .line 111
    :goto_0
    return-void

    .line 104
    :pswitch_0
    invoke-direct {p0}, Lcom/TwinBlade/PicturePassword/Image;->a()V

    goto :goto_0

    .line 108
    :pswitch_1
    invoke-direct {p0}, Lcom/TwinBlade/PicturePassword/Image;->b()V

    goto :goto_0

    .line 102
    :pswitch_data_0
    .packed-switch 0x7f080017
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 5
    .parameter

    .prologue
    const/4 v4, 0x1

    const/4 v3, 0x0

    .line 35
    invoke-static {p0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v0

    .line 36
    const-string v1, "ForceOrientation"

    const-string v2, "0"

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 37
    const-string v1, "0"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_3

    .line 38
    invoke-static {}, Lcom/TwinBlade/PicturePassword/Utilities;->a()Z

    move-result v0

    if-nez v0, :cond_2

    .line 39
    invoke-virtual {p0, v4}, Lcom/TwinBlade/PicturePassword/Image;->setRequestedOrientation(I)V

    .line 49
    :cond_0
    :goto_0
    invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V

    .line 50
    const v0, 0x7f030005

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/Image;->setContentView(I)V

    .line 52
    const v0, 0x7f080017

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/Image;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/Image;->a:Landroid/widget/Button;

    .line 53
    const v0, 0x7f080018

    invoke-virtual {p0, v0}, Lcom/TwinBlade/PicturePassword/Image;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Lcom/TwinBlade/PicturePassword/Image;->b:Landroid/widget/Button;

    .line 54
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/Image;->a:Landroid/widget/Button;

    invoke-virtual {v0, p0}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 55
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/Image;->b:Landroid/widget/Button;

    invoke-virtual {v0, p0}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 57
    invoke-static {p0}, Lcom/TwinBlade/PicturePassword/bd;->a(Landroid/content/Context;)Z

    move-result v0

    if-nez v0, :cond_1

    .line 58
    iget-object v0, p0, Lcom/TwinBlade/PicturePassword/Image;->b:Landroid/widget/Button;

    invoke-virtual {v0, v3}, Landroid/widget/Button;->setEnabled(Z)V

    .line 60
    :cond_1
    return-void

    .line 41
    :cond_2
    invoke-virtual {p0, v3}, Lcom/TwinBlade/PicturePassword/Image;->setRequestedOrientation(I)V

    goto :goto_0

    .line 43
    :cond_3
    const-string v1, "1"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_4

    .line 44
    invoke-virtual {p0, v4}, Lcom/TwinBlade/PicturePassword/Image;->setRequestedOrientation(I)V

    goto :goto_0

    .line 45
    :cond_4
    const-string v1, "2"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 46
    invoke-virtual {p0, v3}, Lcom/TwinBlade/PicturePassword/Image;->setRequestedOrientation(I)V

    goto :goto_0
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 2
    .parameter

    .prologue
    .line 115
    invoke-virtual {p0}, Lcom/TwinBlade/PicturePassword/Image;->getMenuInflater()Landroid/view/MenuInflater;

    move-result-object v0

    .line 116
    const v1, 0x7f030006

    invoke-virtual {v0, v1, p1}, Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V

    .line 117
    const/4 v0, 0x1

    return v0
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 2
    .parameter

    .prologue
    .line 122
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v0

    const v1, 0x7f080019

    if-ne v0, v1, :cond_0

    .line 123
    invoke-direct {p0}, Lcom/TwinBlade/PicturePassword/Image;->c()V

    .line 124
    const/4 v0, 0x1

    .line 126
    :goto_0
    return v0

    :cond_0
    invoke-super {p0, p1}, Landroid/app/Activity;->onOptionsItemSelected(Landroid/view/MenuItem;)Z

    move-result v0

    goto :goto_0
.end method
